import QtQuick 2.5
import QtQuick.Controls 2.5
//import QtQuick.Controls.Styles 1.4


Rectangle{
    width: 500
    height: 200
    //anchors.top: htmlViewerId.bottom
    border.color: "grey"
    border.width: 0.5
    signal signalTextChanged()
    ScrollView {
        id: view
        anchors.fill: parent
        ScrollBar.vertical.policy:ScrollBar.AlwaysOn
        TextArea {
            id:htmlTextArea
            textFormat: "RichText"
            clip:true
            wrapMode: Text.WrapAnywhere
            font.pointSize: 12
            padding: 5
            rightPadding: 10
            mouseSelectionMode:TextEdit.SelectCharacters
            onTextChanged: {
                signalTextChanged()
            }
        }
    }

    function getEditText()
    {
        return htmlTextArea.text
    }

    function setHtml(html)
    {
        htmlTextArea.text = html
    }

    function setTextFormat(fmt)
    {
        htmlTextArea.textFormat = fmt
        htmlTextArea.clear()
    }

    function setReadOnly(isReadonly)
    {
        htmlTextArea.readOnly = isReadonly
    }
}


